1. Field of the Invention
The present invention pertains to the field of digital image compression. More particularly, this invention pertains to algorithms for near-lossless digital video compression.
2. Background of the Related Art
A video signal comprises a sequence of frames or images which when displayed at a given frame rate (e.g., 15 to 30 frames per second) simulates the appearance of motion to a human observer. Each frame of the video image comprises a matrix of picture elements, known as xe2x80x9cpixelsxe2x80x9d or xe2x80x9cpels.xe2x80x9d A pixel is the minimum unit of the picture which may be assigned a luminance intensity and a color. In a computer, depending on the data format used, as many as 3 bytes of data can be used to define visual information for a pixel. One popular data format assigns a luminance intensity represented by 1 byte of data to each pixel and further assigns a color represented by 2 bytes of data to groups of 4 pixels each. This format results in an average use of 12 data bits to represent each pixel. Therefore, a single frame at a resolution of 320xc3x97240 can be represented by about 120,000 bytes of data.
Digital video cameras must transfer frame data to a video memory system for display. Multiple frames are transferred over a period of time. The number of frames transferred and displayed per second is referred to as the frame rate. In general, greater frame rates contribute to heightened appearances of motion, while lower frame rates contribute to the observer being able to perceive individual frames, thus destroying the appearance of motion. A frame rate of 15 frames per second (fps) with a resolution of 320xc3x97240 and each pixel being represented by an average of 12 bits requires that about 14 Mbits of data must be transferred between the digital video camera and the video memory each second.
Digital video cameras are typically connected to a computer system via a peripheral bus. One peripheral bus that is gaining wide acceptance in the computer industry is the Universal Serial Bus (USB). The USB data transfer rate of 8 Mbits/second supports a wide variety of desktop peripherals, from modems, printers, microphones and speakers to graphics tablets, game controls, joysticks, scanners, and digital cameras. However, the USB data rate of 8 Mbits/second is insufficient to support a frame rate of 15 fps for 320xc3x97240 video. Further, since several devices may reside on the USB, it is desirable that a digital camera not use the entire 8 Mbits/second.
Data compression allows an image or video segment to be transferred and stored in substantially fewer bytes of data than required for uncompressed frames. Many methods of digital video compression are based on the idea of eliminating redundant information from frame to frame in a digitized video segment. This is referred to as xe2x80x9cinterframe compression.xe2x80x9d Interframe compression methods exploit the temporal redundancy that exists between digital video frames from the same scene recorded moments apart in time. This reduces the required data needed to encode each frame.
Interframe compression is not ideally suited to the USB environment. This is due to the fact that the USB architecture will not guarantee that every frame of digital video data will be transferred. It is possible that some frames may be dropped. Since interframe compression techniques depend on frame-by-frame redundancies, dropped frames can have a significant impact on picture quality. Therefore, it is desirable to provide a method and apparatus for compressing digital video images that will allow digital cameras to operate on peripheral busses such as the USB.
Further, it is desirable to provide a method and apparatus for compressing digital video images that is not perceived as xe2x80x9clossyxe2x80x9d by the human visual system. Video compression techniques that humans perceive as xe2x80x9clossyxe2x80x9d do not fully preserve all the information originally captured in an image. In general, for xe2x80x9clossyxe2x80x9d techniques, as the compression of the video data is increased, the quality of the video suffers.
A method and apparatus for encoding a digital image is disclosed. A difference is calculated between a first sample and a second sample. A quantization table level is selected from a quantization table the includes at least one level, and information identifying the selected level is placed into an information stream. A quantizer is selected from the quantization table level based on the calculated difference and information corresponding to the selected quantizer is placed into the information stream.